package at.fhooe.tof.bl;

import at.fhooe.tof.app.Observer;

public class ConditionCheck {

	private static float max_begin_dist = 1.5f; // less than 1m
	private static float distance = 0.0f;

	public static boolean checkStartDistance(float dist) {
		Observer.sendMsg("dist" + dist);
		distance = dist;
		if (dist < max_begin_dist) {
			return true;
		} else {
			return false;
		}
	}

	public static void checkColorFeedback(boolean isRHTrackingSet, boolean isLHTrackingSet) {
		if(isRHTrackingSet && isLHTrackingSet && (distance <= 1.2 && distance >= 0.8)){
			StateManager.checkStateCondition(2);
		}else if((isRHTrackingSet && !isLHTrackingSet)||(!isRHTrackingSet && isLHTrackingSet) || (distance > 1.2 || distance < 0.8)){
			StateManager.checkStateCondition(1);
		}else if(!isRHTrackingSet && !isLHTrackingSet){
			StateManager.checkStateCondition(0);
		}
	}
}
